use super::log;

pub static mut DEBUG: bool = false;
pub static mut OPEN_LOG: bool = false;
pub static mut LOG_FILE: &'static str = "";
pub static mut LOG_FILE_MAX_NUM: u32 = 30;
pub static mut LOG_LEVEL: log::LEVEL = log::LEVEL::Trace;

#[allow(dead_code)]
#[derive(Debug, Clone)]
pub struct Config {
    pub debug: bool,
    pub open_log: bool,
    pub log_file: &'static str,
    pub log_file_num: u32,
    pub log_level: log::LEVEL,
}

#[allow(dead_code)]
impl Config {
    pub fn new() -> Self {
        Config {
            debug: unsafe { DEBUG },
            open_log: unsafe { OPEN_LOG },
            log_file: unsafe { LOG_FILE },
            log_file_num: unsafe { LOG_FILE_MAX_NUM },
            log_level: unsafe { LOG_LEVEL },
        }
    }
    pub fn get_debug(&self) -> bool {
        self.debug
    }
    pub fn get_open_log(&self) -> bool {
        self.open_log
    }
    pub fn get_log_file(&self) -> &'static str {
        self.log_file
    }
    pub fn get_log_file_max_num(&self) -> u32 {
        self.log_file_num
    }
    pub fn get_log_level(&self) -> log::LEVEL {
        self.log_level
    }
}
